<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'home';
$return['ischecklogin']=cfc('core')->checklogin('','',true);
if($_RQ['op']=='home'){
	if(!empty($_SESSION['openid'])){
		$openid = $_SESSION['openid'];
		$fansfollow=pdo_getcolumn('core_fans',array('uniacid'=>$_SESSION['uniacid'],'openid'=>$_SESSION['openid']),'follow');
	}
	$return['list']= array();
	if($return['pluginset']['bi_sale2']>0 && $_RQ['fromuser']){
		if($return['pluginset']['bi_sale2max']>0){
			$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
			$isgetfee=pdo_getsum('core_credit_log',array('createtime >'=>$daytime,'uniacid'=>$_SESSION['uniacid'],'mid'=>$_RQ['fromuser'],'plugin'=>'jy_fyiyan','tag like'=>'%bi_sale2%'),'fee');
			if($isgetfee>=$return['pluginset']['bi_sale2max']){
				$nogetfee=1;
			}
		}
		if(!$nogetfee){
			//今天来自某人的
			$isgetfee=pdo_getsum('core_credit_log',array('createtime >'=>$daytime,'uniacid'=>$_SESSION['uniacid'],'mid'=>$_RQ['fromuser'],'plugin'=>'jy_fyiyan','tag'=>'bi_sale2'.$_SESSION['uid']),'fee');
		}
		if(!$nogetfee && !$isgetfee){
			model('core/member')->member_credit($_RQ['fromuser'],'credit3',$return['pluginset']['bi_sale2'],true,'jy_fyiyan','每次分享赚金币','bi_sale2'.$_SESSION['uid']);
		}
	}
	$return['apiurl']=$return['pluginset']['apiurl']?:'https://chat.baidu.com';
	$return['post']= array('msg'=>'');
	$return['sharedata']=array(
		'title'=>$return['pluginset']['share_title'],
		'desc'=>$return['pluginset']['share_desc'],
		'link'=>custom_url('jy_fyiyan/index//fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>ATTACHMENT_URL.$return['pluginset']['share_image'],
	);
	set_html('title',$return['pluginset']['title']?:'A6智能聊天对话');
	exi($return);
}